{include file='public/meta' }
	<!--/meta 作为公共模版分离出去-->
	<title>会员列表 - 会员管理 - Muyu CMS内容管理系统</title>
	<meta name="keywords" content="Muyu CMS内容管理系统,Muyu,木鱼CMS,木鱼">
    <meta name="description" content="木鱼(muyucms.com)内容管理系统是一个简洁、轻量、实用的建站系统！">
	{load href="__ADMINLIB__laypage/page.css"}
</head>
<body>
	<div class="wap-container">
		<nav class="breadcrumb" style="background-color:#fff;padding: 0 24px">
			首页
			<span class="c-gray en">/</span>
			会员管理
			<span class="c-gray en">/</span>
			会员列表
			<a class="btn btn-success radius f-r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
		</nav>
		<article class="Hui-admin-content clearfix">
			<div class="panel">
				<div class="panel-body">
					<div class="text-c"> 日期范围：
						<input type="text" id="search-datetime-start" class="input-text datetimepicker-input" style="width:120px;">
						-
						<input type="text" id="search-datetime-end" class="input-text datetimepicker-input" style="width:120px;">
						<input type="text" class="input-text" style="width:250px" placeholder="输入会员名称、电话、邮箱" id="search-input" name="">
						<button type="submit" class="btn btn-success radius" id="search-submit" name=""><i class="Hui-iconfont">&#xe665;</i> 搜用户</button>
					</div>
				</div>
			</div>
			<div class="panel mt-10">
				<div class="panel-body">
					<div class="clearfix">
						<span class="f-l">
							<a href="javascript:;" id="datadel" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
							<a href="javascript:;"  onClick="admin_edit('添加用户','{:url('member/newadd')}')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加用户</a>
						</span>
						<span class="f-r">共有数据：<strong>{$member->count('id')}</strong> 条</span>
					</div>
					<div class="clearfix mt-20">
						<table class="table table-border table-bordered table-hover table-bg table-sort">
							<thead>
								<tr class="text-c">
									<th width="25"><input type="checkbox" name="" value=""></th>
									<th width="40">ID</th>
									<th width="100">会员账户</th>
									<th width="80">会员昵称</th>
									<th width="40">性别</th>
									<th width="90">手机</th>
									<th width="150">邮箱</th>
									<th width="130">加入时间</th>
									<th width="70">状态</th>
									<th width="100">操作</th>
								</tr>
							</thead>
							<tbody>
								{foreach $member as $val}
								<tr class="text-c">
									<td><input type="checkbox" value="{$val.id}" name=""></td>
									<td>{$val.id}</td>
									<td><a onclick="admin_edit('用户编辑','{:url('Member/edit',['id'=>$val.id])}')">{$val.account}</a></td>
									<td>{$val.name}</td>
									<td>{$val.sex}</td>
									<td>{$val.phone}</td>
									<td>{$val.email}</td>
									<td>{:date("Y-m-d",$val.create_time)}</td>
									<td class="td-status">
										{if condition="$val.status eq '已启用'"}
										<span class="label label-success radius">{$val.status}</span>
										{else /}
										<span class="label radius">{$val.status}</span>
										{/if}
										</td>									
									<td class="td-manage">
										{if condition="$val.status eq '已启用'"}
										<a style="text-decoration:none" onClick="member_stop(this,'{$val.id}')" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a> 
										{else /}
										<a style="text-decoration:none" onClick="member_start(this,'{$val.id}')" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe615;</i></a>
										{/if}
										
										<a title="编辑" href="javascript:;" onclick="admin_edit('用户编辑','{:url('Member/edit')}'+'?id='+{$val.id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
										
										<a title="删除" class="del" data-name="{$val.name}" data-id="{$val.id}" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
								</tr>
								{/foreach}
							</tbody>
						</table>
					</div>
					{$member|raw}
				</div>
			</div>
		</article>
	</div>
	<!--_footer 作为公共模版分离出去-->
{include file='public/footer' }
	<!--/_footer /作为公共模版分离出去-->

	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript" src="__ADMINLIB__datatables/1.10.15/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="__ADMINLIB__laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="__ADMINST__business/js/main.js"></script>
	<script type="text/javascript">
		$(function(){
			$("#search-datetime-start").datetimepicker({
			  format: "yyyy-mm-dd",
			  minView: "month",
			  language: "zh-cn",
			  autoclose: true
			});
			$("#search-datetime-end").datetimepicker({
			  format: "yyyy-mm-dd",
			  minView: "month",
			  language: "zh-cn",
			  autoclose: true
			});
      // 全选 页面调用
      $(".table").HuicheckAll(
        {
          checkboxAll: 'thead input[type="checkbox"]',
          checkbox: 'tbody input[type="checkbox"]'
        },
        function(checkedInfo) {
          console.log(checkedInfo);
        }
      );
		});
	</script>
	<script>
		//删除操作
		$(".del").click(function() {
			//获取删除信息和对应id
			var name = $(this).attr('data-name');
			var id = $(this).attr('data-id');
			layer.msg('是否删除\"' + name + '\"管理员?', {
				time: 5000, //5s后自动关闭
				shade: 0.3,
				btn: ['删除', '取消'],
				yes: function() {
					//执行删除
					$.post("{:url('Member/delete')}", {
						ids: id
					}, function(data) {
						layer.msg(data.msg, {
							time: 2000
						}, function() {
							if (data.url) location.href = data.url;
						});
					})
				}
			});
		})
	</script>
	<script>
		/*会员-停用*/
		function member_stop(obj,id){
		  layer.confirm('确认要停用吗？',function(index){
		    //此处请求后台程序，下方是成功后的前台处理……
			$.get("{:url('Member/setstatus')}",{id:id});
			
		    $(obj).parents("tr").find(".td-manage").prepend('<a onClick="member_start(this,'+id+')" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>');
		    $(obj).parents("tr").find(".td-status").html('<span class="label radius">已停用</span>');
		    $(obj).remove();
		    layer.msg('已停用!',{icon: 5,time:1000});
		  });
		}
		
		/*会员-启用*/
		function member_start(obj,id){
		  layer.confirm('确认要启用吗？',function(index){
		    //此处请求后台程序，下方是成功后的前台处理……
			$.get("{:url('Member/setstatus')}",{id:id});
		
		    $(obj).parents("tr").find(".td-manage").prepend('<a onClick="member_stop(this,'+id+')" href="javascript:;" title="停用" style="text-decoration:none"><i class="Hui-iconfont">&#xe631;</i></a>');
		    $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
		    $(obj).remove();
		    layer.msg('已启用!', {icon: 6,time:1000});
		  });
		}
		
		
		//批量删除
		$("#datadel").click(function() {
		var id=$("tbody input:checkbox");
		var ids=[];
		for(i=0;i<id.length;i++){
			if($(id[i]).is(":checked")){
				ids += $(id[i]).val()+',';
			}
		}
		//console.log(ids);
			var delid = ids;
			//console.log(delid);
		if(delid == ""){
			layer.msg('当前未选择任何信息!',{icon:2,time:2000});
		}else{
			layer.confirm('确认要批量删除吗？',function(index){
			//console.log(delid);
			$.post("{:url('Member/deleteall')}",{delid},function(data){
				layer.msg(data.msg, {time: 2000}, function() {
					if(data.url) location.href = data.url;
				});
			});
			});
		}
		});
		
		
		
		// 点击搜索执行...
		$("#search-submit").click(function(index) {
			var time = $('#search-datetime-start').val();
			var time1 = $('#search-datetime-end').val();
			var search = $('#search-input').val();
			if(time =="" && time1 =="" && search ==""){
				layer.msg("请输入搜索内容!", {time: 2000});
			}else{
				layer.open({
					type:2,
					area:['100%','100%'],
					content:'{:url('Member/soulist')}'+'?so='+ search + '&t1='+time+'&t2='+time1,
					end:function(){
						location.reload();
					}
				});
			}
		});
	</script>
	<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
